import * as zrender from "zrender";
import { barHeight, barMargin, unitWidth } from "../../config";
/**
 * TODO 根据视口宽度绘制水平网格线
 * 绘制水平网格线
 * @param {Object} zr ZRender实例
 * @param {Object} chartState 图表状态对象
 */
export function drawHorizontalGridLines(zr: any, chartState: ChartState) {
  // 网格线结束X
  const gridEndX = chartState.timeScaleWidth * unitWidth;

  // 绘制水平网格线
  for (let j = 0; j < 1; j++) {
    const gridY = chartState.chartStartY + j * (barHeight + barMargin);

    const gridLineY = new zrender.Line({
      shape: {
        x1: chartState.chartStartX,
        y1: gridY,
        x2: gridEndX + chartState.chartStartX,
        y2: gridY
      },
      style: {
        stroke: "lightgray"
      }
    });
    zr.add(gridLineY);
  }
} 